package com.example.mybatisstudy1.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.mybatisstudy1.entity.Order;
import com.example.mybatisstudy1.mapper.OrderMapper;
import com.example.mybatisstudy1.service.OrderService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class OrderServiceImpl implements OrderService {

   final private OrderMapper orderMapper;


    public OrderServiceImpl(OrderMapper orderMapper) {
        this.orderMapper = orderMapper;
    }


    @Override
    public List<Order> search() {
        QueryWrapper<Order> queryWrapper = new QueryWrapper<>();
        List<Order> orders = orderMapper.selectList(queryWrapper);
//        System.out.println(orders);
        return orders;
    }

    @Override
    public void deleteById(String id) {
        orderMapper.deleteById(id);
    }
}
